package cn.t16.ms.controller;

import cn.t16.common.Result;
import cn.t16.ms.feign.order.OrderClient;
import cn.t16.ms.feign.product.ProductClient;
import cn.t16.ms.feign.user.UserClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class DemoController {
    @Resource
    private UserClient userClient;
    @Resource
    private OrderClient orderClient;
    @Resource
    private ProductClient productClient;
    @GetMapping("/getMyOrder/{userId}")
    public Result getMyOrder(@PathVariable Integer userId) {
        return userClient.myorders(userId);
    }

    @GetMapping("/getUser/{id}")
    public Result getUser(@PathVariable Integer id) {
        return userClient.get(id);
    }
    @GetMapping("/getOrder/{id}")
    public Result getOrder(@PathVariable Integer id) {
        return orderClient.get(id);
    }
    @GetMapping("/getProduct/{id}")
    public Result getProduct(@PathVariable Integer id) {
        return productClient.get(id);
    }
}
